package com.stylefeng.guns.modular.system.warpper;

import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.core.base.warpper.BaseControllerWarpper;

import java.util.List;
import java.util.Map;

/**
 * 用户管理的包装类
 *
 * @author fengshuonan
 * @date 2017年2月13日 下午10:47:03
 */
public class OrderFeeWarpper extends BaseControllerWarpper {

    public OrderFeeWarpper(List<Map<String, Object>> list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {

        String type=map.get("fee_type").toString();
        if(type.equals("0")){
            int feeId=Integer.valueOf(map.get("feeId").toString());
            String userName="";
            String use_object="";
            switch (feeId){
                case 1:
                    userName=map.get("consignee")==null?"":map.get("consignee").toString();
                    use_object="收货人";
                    break;
                case 2:
                    userName=map.get("consignee")==null?"":map.get("consignee").toString();
                    use_object="收货人";
                    break;
                case 3:
                    userName=map.get("send_dept_name")==null?"":map.get("send_dept_name").toString();
                    use_object="发货方";
                    break;
                case 4:
                    break;
                case 5:
                    userName=map.get("send_dept_name")==null?"":map.get("send_dept_name").toString();
                    use_object="发货方";
                    break;
                case 6:
                    userName=map.get("transfer_name")==null?"":map.get("transfer_name").toString();
                    use_object="中转点";
                    break;
                case 20:
                    use_object="司机";
                    break;
                case 21:
                    use_object="发货方";
                    break;
            }
            if(map.get("modeType").toString().equals("中转")){
                userName=map.get("transfer_name")==null?"":map.get("transfer_name").toString();
                use_object="中转点";
            }
            if(map.get("modeType").toString().equals("配送")){
                userName=map.get("really_user")==null?"":map.get("really_user").toString();
                use_object="司机";
            }
            map.put("userName",userName);
            map.put("use_object",use_object);
//            if(map.get("feeId").toString().equals("中转")){
//                map.put("userName",map.get("consignee"));
//                map.put("userName","收货人");
////                事务对象 多选 1本地事务 2 上游网点 3 收货人 4 中转网点
//            }else if(map.get("modeType").toString().equals("自提")){
//                if(map.get("use_object").toString().contains("3")){
//
//                }
//                map.put("userName",map.get("consignee"));
//                map.put("userName","收货人");
//            }else if(map.get("modeType").toString().equals("配送")){
//                map.put("userName",map.get("consignee"));
//                map.put("userName","收货人");
//            }

        }else{
            map.put("userName","");
            map.put("use_object","");
        }
    }

}
